package com.contactmgr.activity;

import java.util.List;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.contactmgr.R;
import com.contactmgr.listadapter.SeparatedListAdapter;
import com.contactmgr.listadapter.SmsListAdapter;
import com.contactmgr.logObjects.Sms;
import com.contactmgr.utils.ReadDataAppContext;

public class SmsLogActivity extends ListActivity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		List<Sms> inboxResolved=((ReadDataAppContext)getApplicationContext()).getInboxResolved();
		List<Sms> sentItemsResolved=((ReadDataAppContext)getApplicationContext()).getSentItemsResolved();
		/** separated list adapter for sms **/
		SeparatedListAdapter smsAllAdp = new SeparatedListAdapter(this);
		ArrayAdapter<Sms> smsInboxAdp = new SmsListAdapter(this, R.layout.list_sms, inboxResolved);
		ArrayAdapter<Sms> smsSentAdp = new SmsListAdapter(this, R.layout.list_sms, sentItemsResolved);
		smsAllAdp.addSection("Inbox", smsInboxAdp);
		smsAllAdp.addSection("SentItems", smsSentAdp);
		this.setListAdapter(smsAllAdp);
	}

}
